<template>
  <div class="show-content">
    <div class="content-style" id="content-style">
      <!-- pre标签会按照原文进行排版显示 -->
      <pre class="style-code" v-html="styleMsg"></pre>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      styleMsg: "",
    };
  },
  methods: {
    writeStyleCode(code) {
      this.styleMsg = code;
      document.getElementById("content-style").scrollTop =
        document.getElementById("content-style").scrollHeight;
    },
  },
};
</script>

<style lang="less">
.show-content {
  float: left;
  position: relative;
  width: 25%;
  height: 100%;
  padding: 1rem 2rem;
  box-sizing: border-box;
  background: #fff;
}
.content-style {
  position: relative;
  width: 100%;
  height: 99%;
  overflow: auto;
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.5);
}
.content-style::-webkit-scrollbar {
  display: none;
}
.style-code {
  margin: 1rem 0;
}
</style>